import { loadPageApiViews } from './api-scan-local'
import type { PageView } from './api-scan-local'


export function scanApiFromPages(menuGroup: string): Promise<PageView[]> {
    if (menuGroup == 'local') {
        return new Promise<PageView[]>((resolve, reject) => {
            loadPageApiViews().then((pageApiViews) => {
                const filteredPageApiViews = pageApiViews.filter((pageView) => {
                    return Array.isArray(pageView.apis) && pageView.apis.length > 0
                })
                resolve(filteredPageApiViews)
            }).catch(error => {
                reject(error)
            })
        })
    } else {
        return Promise.resolve([])
    }
}